package com.swpu.course_schedule.POJO.Course;

import java.util.List;

public class ClassroomCourseArrange {
    private Classroom classroom;
    private List<CourseArrange> courseArranges;

    /**
     * 返回课程信息
     * @param WEEK 周次
     * @param DAY 星期
     * @param SESSION 开始节次
     * @param SESSION_COUNT 持续节次
     * @return 具体课程信息，如果无课则为空
     */
    public String getCourse(
            int WEEK,
            int DAY,
            int SESSION) {
        StringBuilder course = new StringBuilder();
        for (CourseArrange ca :
                courseArranges) {
            if (WEEK >= ca.getS_WEEK() && WEEK <= ca.getE_WEEK() &&
                DAY == ca.getDAY() && SESSION == ca.getSESSION()){
                course.append(String.valueOf(ca.getC_ID()));
                course.append("\n");
                course.append(String.valueOf("专业"));
            }
        }
        return course.toString();
    }

    public ClassroomCourseArrange(Classroom classroom, List<CourseArrange> courseArranges) {
        this.classroom = classroom;
        this.courseArranges = courseArranges;
    }

    public ClassroomCourseArrange() {
    }

    @Override
    public String toString() {
        return "ClassroomCourseArrange{" +
                "classroom=" + classroom +
                ", courseArranges=" + courseArranges +
                '}';
    }

    public Classroom getClassroom() {
        return classroom;
    }

    public void setClassroom(Classroom classroom) {
        this.classroom = classroom;
    }

    public List<CourseArrange> getCourseArranges() {
        return courseArranges;
    }

    public void setCourseArranges(List<CourseArrange> courseArranges) {
        this.courseArranges = courseArranges;
    }
}
